#ifndef __RENDERER_H__
#define __RENDERER_H__

#include "HandModel.h"
#include <vector>

/* A class manage on creating OPENGL context and drawing hypothesis depth map  */
class HandModelRenderer
{
public:
	HandModelRenderer();
	~HandModelRenderer();
	GLFWwindow * window;

	HandModel rHand;

	/*x+- 12.8 ; y+-7.48*/
	int screen_width;
	int screen_height;

	int particle_screen_width;
	int particle_screen_height;

	float pixel_per_mm; 
	float mm_per_Pixel;

	float frushtum_focal;//(pixels) ~ 400mm : 
	float frushtum_far;//(pixels) ~ 1400mm
	
	void initializeGLContext();

	GLuint obsDepthBuffer;
	GLuint obsSkinBuffer;
	GLuint renBuffer;

	GLuint frameBuffer,renderFrameBuffer;
	GLuint half_FBO,half_RBO;

	GLuint depth_tex2d,color_tex2d;
	GLuint obsDepth_tex2d,obsSkin_tex2d;

	void renderHandModelGL();
	void renderHandModelGL_Comparing(HypothesisX observeModel,HypothesisX tempModel);
	void renderMultiModelGL(std::vector<HypothesisX> &hypos);
	void terminateGLContext();
	void putDepthToBuf(GLuint & buffer);

	//void putDepthToTex2D(GLuint & tex2d);

private:
	void initializePixelBufs();
	void initializeTexture2D();
};

#endif